package com.cw.base.jeeyc.controller;

import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cw.base.jeeyc.biz.intf.ApiDatabaseQueryBiz;
import com.cw.base.common.model.dto.response.CommonRespDto;
import com.cw.base.jeeyc.api.dto.ApiDatabaseDto;
import com.cw.base.jeeyc.api.intf.ApiDatabaseQueryApi;

/**
 * api数据库信息
 *
 * @author chenw
 * @date 2019-08-24 10:59:29
 */
@RestController
@RequestMapping("/v1/apiDatabaseQuery")
@DubboService(group = "hrkj-jeeyc-center",version = "1.0.0",protocol = "dubbo")
public class ApiDatabaseQueryApiImpl implements ApiDatabaseQueryApi {
    @Autowired
    private ApiDatabaseQueryBiz apiDatabaseBiz;

    /**
     * 分页查询api数据库信息
     *
     * @param request 条件
     * @return PageInfo<ApiDatabaseDto>
     */
    @Override
    public CommonRespDto<Page<ApiDatabaseDto>> selectPage(@RequestBody ApiDatabaseDto request) {
        Page<ApiDatabaseDto> pageInfo = apiDatabaseBiz.selectPage(request);
        return CommonRespDto.<Page<ApiDatabaseDto>>builder().data(pageInfo).build();
    }

    /**
     * 查询api数据库信息详情信息
     *
     * @param request 条件
     * @return ApiDatabaseDto
     */
    @Override
    public CommonRespDto<ApiDatabaseDto> queryApiDatabaseDetail(@RequestBody ApiDatabaseDto request) {
        ApiDatabaseDto apiDatabaseDto = apiDatabaseBiz.queryDetail(request);
        return CommonRespDto.<ApiDatabaseDto>builder().data(apiDatabaseDto).build();
    }
}
